<!DOCTYPE html>
<html>
<!-- head -->
<link href="//unpkg.com/layui@2.7.6/dist/css/layui.css" rel="stylesheet">
<style>
    * {
        -webkit-box-sizing: unset !important;
    }
</style>
<body>
<div id="test1" class="demo-tree demo-tree-box"></div>
<script src="//unpkg.com/layui@2.7.6/dist/layui.js"></script>
<script>
    layui.use(['tree', 'util'], function () {
        var tree = layui.tree
            , layer = layui.layer
            , util = layui.util

            //模拟数据1
            , data1 = {$data};

        //常规用法
        tree.render({
            elem: '#test1' //默认是点击节点可进行收缩
            , data: data1
        });
    });
</script>
</body>
</html>